#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;


struct Base{

	int len[100500], sub[100500], to[100500][26];
	char s[100500];
	int first, size, n;


	void init()
	{
		len[1] = -1, sub[2] = 1, s[0] = '#', n = 0, first = 2, size = 3;
	}

	int getNextSuf(int cur)
	{
		if(cur == 0) return 1;
		while(s[n] != s[n - len[cur] - 1] ) cur = sub[cur];
		return cur;
	}


	int addLetter(char c)
	{
		s[++n] = c;
		first = getNextSuf(first);
		int second = to[getNextSuf(sub[first])][ s[n] - 'a'];
		int & nxt = to[first][ s[n] - 'a'];
		if(nxt == 0)
		{
			nxt = size++;
			len[nxt] = len[first] + 2;
			sub[nxt] = second ? second : 2;
		}
		first = nxt;
		return size - 3;
	}
} base;



char S[100500];

int main()
{	
	base.init();
	scanf("%s", S + 1);
	int N = strlen(S + 1);
	for(int i = 1; i <= N; i++)
	{
		int res = base.addLetter(S[i]);
		printf("%d\n", res);
	}
	return 0;
}